const elSelectChildren = (h, options) => {
  const list = []
  options.forEach(item => {
    let value = item.label

    list.push(<el-option label={item.label} value={value}></el-option>)
  })
  return list
}

const elCheckboxGroupChildren = (h, options) => {
  const list = []
  options.forEach(item => {
    let value = item.label
    list.push(<el-checkbox label={value}>{item.label}</el-checkbox>)
  })
  return list
}

const elRadioGroupChildren = (h, options) => {
  const list = []
  options.forEach(item => {
    let value = item.label
    if(typeof value === 'undefined') {
      value = item.label
    }
    list.push(<el-radio label={value}>{item.label}</el-radio>)
  })
  return list
}


const renderConfig = {
  'el-select': elSelectChildren,
  'el-checkbox-group': elCheckboxGroupChildren,
  'el-radio-group': elRadioGroupChildren
}
const slotChildren = (h, tag, options) => {

  const renderFn = renderConfig[tag]
  if(!renderFn) return []
  return renderFn(h, options)
}

export {
  slotChildren
}
